package fti.uksw.ruang.model;

import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class CalendarEvent implements Parcelable {

	public static final String TAG = "calendarevent";

	public static final String TABLE_NAME = "tbcalendar_event";
	public static final String ID = "Id";
	public static final String SUBJECT = "Subject";
	public static final String LOCATION = "Location";
	public static final String DESCRIPTION = "Description";
	public static final String STARTTIME = "StartTime";
	public static final String ENDTIME = "EndTIme";
	public static final String ISALLDAYEVENT = "IsAllDayEvent";
	public static final String COLOR = "Color";
	public static final String RECURRINGRULE = "RecurringRule";
	public static final String CALENDARID = "Calendar_id";
	public static final String EVENTID = "event_id";
	public static final String OPERATORID = "operator_id";

	public static final int FLAG = 1;
	public static final int UNFLAG = -1;

	private int id;
	private String location;
	private String subject;
	private String description;
	private Date startTime;
	private Date endTime;
	private int isAllDayEvent;
	private String color;
	private int recurringRule;
	private int operatorId;
	private String calendarId;
	private String eventId;

	private RecurringDetail rd;
	private Guest guest;
	private Pengguna pengguna;
	private CalendarList cl;
//	private PenggunaRuang pr;
	
//	public PenggunaRuang getPenggunaRuang(){
//        return pr;
//    }
    
//    public void setPenggunaRuang(PenggunaRuang pr){
//        this.pr = pr;
//    }
    	
	public void setCalendarList(CalendarList cl){
		this.cl = cl;
	}
	
	public CalendarList getCalendarList(){
		return cl;
	}

	public void setPengguna(Pengguna pengguna) {
		this.pengguna = pengguna;
	}
	
	public Pengguna getPengguna(){
		return pengguna;
	}
	
	public void setGuest(Guest guest) {
		this.guest = guest;
	}
	
	public Guest getGuest(){
		return guest;
	}

	public void setRecurringDetail(RecurringDetail rd) {
		this.rd = rd;
	}

	public RecurringDetail getRecurringDetail() {
		return rd;
	}

	public CalendarEvent() {
	}

	public CalendarEvent(Parcel in) {
		readFromParcel(in);
	}

	public String getEventId() {
		return eventId;
	}

	public void setEventId(String eventId) {
		this.eventId = eventId;
	}

	public String getCalendarId() {
		return calendarId;
	}

	public void setCalendarId(String calendarId) {
		this.calendarId = calendarId;
	}

	public void setOperatorId(int operatorId) {
		this.operatorId = operatorId;
	}

	public int getOperatorId() {
		return operatorId;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getIsAllDayEvent() {
		return isAllDayEvent;
	}

	public void setIsAllDayEvent(int isAllDayEvent) {
		this.isAllDayEvent = isAllDayEvent;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public int getRecurringRule() {
		return recurringRule;
	}

	public void setRecurringRule(int recurringRule) {
		this.recurringRule = recurringRule;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(id);
		dest.writeString(location);
		dest.writeString(subject);
		dest.writeString(description);
		dest.writeLong(startTime.getTime());
		dest.writeLong(endTime.getTime());
		dest.writeInt(isAllDayEvent);
		dest.writeString(color);
		dest.writeInt(recurringRule);
		dest.writeInt(operatorId);
		dest.writeString(calendarId);
		dest.writeString(eventId);
		dest.writeParcelable(rd, flags);
		dest.writeParcelable(guest, flags);
		dest.writeParcelable(pengguna, flags);
		dest.writeParcelable(cl, flags);
//		dest.writeParcelable(pr, flags);
	}

	private void readFromParcel(Parcel in) {
		id = in.readInt();
		location = in.readString();
		subject = in.readString();
		description = in.readString();
		startTime = new Date(in.readLong());
		endTime = new Date(in.readLong());
		isAllDayEvent = in.readInt();
		color = in.readString();
		recurringRule = in.readInt();
		operatorId = in.readInt();
		calendarId = in.readString();
		eventId = in.readString();
		rd = in.readParcelable(RecurringDetail.class.getClassLoader());
		guest = in.readParcelable(Guest.class.getClassLoader());
		pengguna = in.readParcelable(Pengguna.class.getClassLoader());
		cl = in.readParcelable(CalendarList.class.getClassLoader());
//		pr = in.readParcelable(PenggunaRuang.class.getClassLoader());
	}

	public static final Parcelable.Creator<CalendarEvent> CREATOR = new Parcelable.Creator<CalendarEvent>() {

		@Override
		public CalendarEvent createFromParcel(Parcel source) {
			return new CalendarEvent(source);
		}

		@Override
		public CalendarEvent[] newArray(int size) {
			return new CalendarEvent[size];
		}
	};


}
